package guoanmaker.operator.business.controller;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.aliyun.oss.OSSClient;

import guoanmaker.operator.business.model.BackgroundPicture;
import guoanmaker.operator.business.model.InRoundPhone;
import guoanmaker.operator.business.model.OperatorPcitureFactory;
import guoanmaker.operator.business.service.OperatorPcitureFactoryServiceInterface;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import guoanmaker.operator.helper.common.util.OSSUnitHelper;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(ApiController.OPERATOR_PCITURE_FACTORY)
public class OperatorPcitureFactoryController {
	@Autowired
	private OperatorPcitureFactoryServiceInterface operatorPcitureFactoryServiceInterface;
	
	  @ApiOperation(value = "查询库里所有图片", notes = "查询库里所有图片")
	    @PostMapping(value = "getAllOperatorPcitureFactory")
	  public AjaxJson getAllOperatorPcitureFactory() {
		  AjaxJson ajaxJson=new AjaxJson();
	    	try{
	    	List<OperatorPcitureFactory> ops=operatorPcitureFactoryServiceInterface.selectOperatorPcitureFactoryList();
	        ajaxJson.setSuccess(true).setStatus(200).setData(ops);
	        
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		 ajaxJson.setSuccess(false).setStatus(250).setData(null);
	    	}
	    	return ajaxJson;
	    }
	  
	  
	  @ApiOperation(value = "保存图片工厂", notes = "保存图片工厂 ")
	    @PostMapping(value = "saveOperatorPcitureFactory")
	    public AjaxJson saveBackgroundPicture( @RequestBody OperatorPcitureFactory pcitureFactory) {
		  AjaxJson ajaxJson=new AjaxJson();
		  try{
	    		
	 	        	operatorPcitureFactoryServiceInterface.saveOperatorPcitureFactory(pcitureFactory);
	 	        
	 	        	ajaxJson.setSuccess(true).setStatus(200).setData(null);
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		ajaxJson.setSuccess(false).setStatus(250).setData(null);
	    	} 
			 
	        return ajaxJson;
	    }
}
